3.2.8 \(\int e^{x^2} \cos (a+c x^2) \, dx\) [108]

Optimal. Leaf size=83 \[ \frac {e^{-i a} \sqrt {\pi } \text {Erfi}\left (\sqrt {1-i c} x\right )}{4 \sqrt {1-i c}}+\frac {e^{i a} \sqrt {\pi } \text {Erfi}\left (\sqrt {1+i c} x\right )}{4 \sqrt {1+i c}} \]

[Out]

1/4*erfi(x*(1-I*c)^(1/2))*Pi^(1/2)/exp(I*a)/(1-I*c)^(1/2)+1/4*exp(I*a)*erfi(x*(1+I*c)^(1/2))*Pi^(1/2)/(1+I*c)^
(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 83, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 2, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {4561, 2235} \begin {gather*} \frac {\sqrt {\pi } e^{-i a} \text {Erfi}\left (\sqrt {1-i c} x\right )}{4 \sqrt {1-i c}}+\frac {\sqrt {\pi } e^{i a} \text {Erfi}\left (\sqrt {1+i c} x\right )}{4 \sqrt {1+i c}} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[E^x^2*Cos[a + c*x^2],x]

[Out]

(Sqrt[Pi]*Erfi[Sqrt[1 - I*c]*x])/(4*Sqrt[1 - I*c]*E^(I*a)) + (E^(I*a)*Sqrt[Pi]*Erfi[Sqrt[1 + I*c]*x])/(4*Sqrt[
1 + I*c])

Rule 2235

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^2), x_Symbol] :> Simp[F^a*Sqrt[Pi]*(Erfi[(c + d*x)*Rt[b*Log[F], 2
]]/(2*d*Rt[b*Log[F], 2])), x] /; FreeQ[{F, a, b, c, d}, x] && PosQ[b]

Rule 4561

Int[Cos[v_]^(n_.)*(F_)^(u_), x_Symbol] :> Int[ExpandTrigToExp[F^u, Cos[v]^n, x], x] /; FreeQ[F, x] && (LinearQ
[u, x] || PolyQ[u, x, 2]) && (LinearQ[v, x] || PolyQ[v, x, 2]) && IGtQ[n, 0]

Rubi steps

\begin {align*} \int e^{x^2} \cos \left (a+c x^2\right ) \, dx &=\int \left (\frac {1}{2} e^{-i a+(1-i c) x^2}+\frac {1}{2} e^{i a+(1+i c) x^2}\right ) \, dx\\ &=\frac {1}{2} \int e^{-i a+(1-i c) x^2} \, dx+\frac {1}{2} \int e^{i a+(1+i c) x^2} \, dx\\ &=\frac {e^{-i a} \sqrt {\pi } \text {erfi}\left (\sqrt {1-i c} x\right )}{4 \sqrt {1-i c}}+\frac {e^{i a} \sqrt {\pi } \text {erfi}\left (\sqrt {1+i c} x\right )}{4 \sqrt {1+i c}}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.22, size = 107, normalized size = 1.29 \begin {gather*} \frac {\sqrt [4]{-1} \sqrt {\pi } \left (-\left ((-i+c) \sqrt {i+c} \text {Erfi}\left ((-1)^{3/4} \sqrt {i+c} x\right ) (\cos (a)-i \sin (a))\right )+(1-i c) \sqrt {-i+c} \text {Erfi}\left (\sqrt [4]{-1} \sqrt {-i+c} x\right ) (\cos (a)+i \sin (a))\right )}{4 \left (1+c^2\right )} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[E^x^2*Cos[a + c*x^2],x]

[Out]

((-1)^(1/4)*Sqrt[Pi]*(-((-I + c)*Sqrt[I + c]*Erfi[(-1)^(3/4)*Sqrt[I + c]*x]*(Cos[a] - I*Sin[a])) + (1 - I*c)*S
qrt[-I + c]*Erfi[(-1)^(1/4)*Sqrt[-I + c]*x]*(Cos[a] + I*Sin[a])))/(4*(1 + c^2))

________________________________________________________________________________________

Maple [A]
time = 0.11, size = 60, normalized size = 0.72

method result size
risch \(\frac {\sqrt {\pi }\, {\mathrm e}^{-i a} \erf \left (\sqrt {i c -1}\, x \right )}{4 \sqrt {i c -1}}+\frac {\sqrt {\pi }\, {\mathrm e}^{i a} \erf \left (\sqrt {-i c -1}\, x \right )}{4 \sqrt {-i c -1}}\) \(60\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(exp(x^2)*cos(c*x^2+a),x,method=_RETURNVERBOSE)

[Out]

1/4*Pi^(1/2)*exp(-I*a)/(-1+I*c)^(1/2)*erf((-1+I*c)^(1/2)*x)+1/4*Pi^(1/2)*exp(I*a)/(-I*c-1)^(1/2)*erf((-I*c-1)^
(1/2)*x)

________________________________________________________________________________________

Maxima [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 133 vs. \(2 (53) = 106\).
time = 0.29, size = 133, normalized size = 1.60 \begin {gather*} -\frac {\sqrt {\pi } \sqrt {2 \, c^{2} + 2} {\left ({\left (i \, \cos \left (a\right ) + \sin \left (a\right )\right )} \operatorname {erf}\left (\sqrt {i \, c - 1} x\right ) + {\left (-i \, \cos \left (a\right ) + \sin \left (a\right )\right )} \operatorname {erf}\left (\sqrt {-i \, c - 1} x\right )\right )} \sqrt {\sqrt {c^{2} + 1} + 1} - \sqrt {\pi } \sqrt {2 \, c^{2} + 2} {\left ({\left (\cos \left (a\right ) - i \, \sin \left (a\right )\right )} \operatorname {erf}\left (\sqrt {i \, c - 1} x\right ) + {\left (\cos \left (a\right ) + i \, \sin \left (a\right )\right )} \operatorname {erf}\left (\sqrt {-i \, c - 1} x\right )\right )} \sqrt {\sqrt {c^{2} + 1} - 1}}{8 \, {\left (c^{2} + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(exp(x^2)*cos(c*x^2+a),x, algorithm="maxima")

[Out]

-1/8*(sqrt(pi)*sqrt(2*c^2 + 2)*((I*cos(a) + sin(a))*erf(sqrt(I*c - 1)*x) + (-I*cos(a) + sin(a))*erf(sqrt(-I*c
- 1)*x))*sqrt(sqrt(c^2 + 1) + 1) - sqrt(pi)*sqrt(2*c^2 + 2)*((cos(a) - I*sin(a))*erf(sqrt(I*c - 1)*x) + (cos(a
) + I*sin(a))*erf(sqrt(-I*c - 1)*x))*sqrt(sqrt(c^2 + 1) - 1))/(c^2 + 1)

________________________________________________________________________________________

Fricas [A]
time = 2.63, size = 70, normalized size = 0.84 \begin {gather*} \frac {\sqrt {\pi } {\left (i \, c - 1\right )} \sqrt {-i \, c - 1} \operatorname {erf}\left (\sqrt {-i \, c - 1} x\right ) e^{\left (i \, a\right )} + \sqrt {\pi } \sqrt {i \, c - 1} {\left (-i \, c - 1\right )} \operatorname {erf}\left (\sqrt {i \, c - 1} x\right ) e^{\left (-i \, a\right )}}{4 \, {\left (c^{2} + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(exp(x^2)*cos(c*x^2+a),x, algorithm="fricas")

[Out]

1/4*(sqrt(pi)*(I*c - 1)*sqrt(-I*c - 1)*erf(sqrt(-I*c - 1)*x)*e^(I*a) + sqrt(pi)*sqrt(I*c - 1)*(-I*c - 1)*erf(s
qrt(I*c - 1)*x)*e^(-I*a))/(c^2 + 1)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int e^{x^{2}} \cos {\left (a + c x^{2} \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(exp(x**2)*cos(c*x**2+a),x)

[Out]

Integral(exp(x**2)*cos(a + c*x**2), x)

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(exp(x^2)*cos(c*x^2+a),x, algorithm="giac")

[Out]

integrate(cos(c*x^2 + a)*e^(x^2), x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\mathrm {e}}^{x^2}\,\cos \left (c\,x^2+a\right ) \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(exp(x^2)*cos(a + c*x^2),x)

[Out]

int(exp(x^2)*cos(a + c*x^2), x)

________________________________________________________________________________________